const mysql = require("mysql2");

// 创建mysql链接
const connection = mysql.createConnection({
	host: "localhost",
	port: 3306,
	user: 'root',
	password: "200095",
  database:'test'
});

// 执行sql语句  操作数据库
const statement = "SELECT * FROM students;";

connection.query(statement, (err, res, fields) => {
	if (err) {
		console.log("查询失败", err);
    return
	}
  console.log(res);
  console.log(fields);
});
